<template>
 <div>
  <el-upload

  :data={imgSrc:this.$store.state.movie.imgSrc}
  :action="action"
  :auto-upload="true"
  :multiple="false"
  :on-success="videoSuccess"
  :before-upload="beforeUploadVideo"
  name="myFile"

>
视频上传

  <!-- <i class="el-icon-upload"></i>
  <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div> -->
</el-upload>
 </div>
</template>

<script>
import connect from './connect';
export default {
//注意先传图片后传视频，顺序不能乱
  data() {
    return {
      imgSrc:"",
      action:"http://localhost:8889/upVideo"// 要上传的地址
      
      // videoSrc:{
      //  imgSrc:this.$store.state.movie.imgSrc
      // }
    };
  },
  methods: {
    //上传前回调
    beforeUploadVideo(file) {
     
      // console.log("上传前", file);
     
      var fileSize = file.size / 1024 / 1024 < 50;
       const isJPG = file.type === 'video/mp4';
     

        return isJPG && fileSize;
    },
    //   上传文件
    videoSuccess(res,file) {
      this.imageUrl = URL.createObjectURL(file.raw);
     
    },
  }
};

</script>

<style scoped>

</style>